from rest_framework.permissions import BasePermission, IsAuthenticated, SAFE_METHODS


class ReadOnly(BasePermission):
    '''
    自定义只读权限
    '''
    def has_permission(self, request, view):
        # 此处实现自定义逻辑
        return request.method in SAFE_METHODS